local guju = fk.CreateSkill {
  name = "rmt__guju",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["rmt__guju"] = "骨疽",
  [":rmt__guju"] = "锁定技，当有“傀”的角色受到伤害后，你摸一张牌。",

  ["@rmt__guju"] = "骨疽",
  ["rmt__bingzhao_draw"] = "令其额外摸一张牌",
  ["#rmt__bingzhao-ask"] = "你可以令 %src 因“骨疽”额外摸一张牌",

  ["$rmt__guju1"] = "你还没有见过真正的恐惧。",
  ["$rmt__guju2"] = "这些，你就感到害怕了吗？"
}

guju:addEffect(fk.Damaged, {
  can_trigger = function(self, event, target, player, data)
    return target:getMark("@@rmt__puppet") > 0 and player:hasSkill(guju.name) and target:isAlive()
  end,
  on_use = function(self, event, target, player, data)
    ---@type string
    local skillName = guju.name
    local num = 1
    local room = player.room
    if target.kingdom == player:getMark("@rmt__bingzhao") and player:hasSkill("rmt__bingzhao") then
      if
        room:askToChoice(
          target,
          {
            choices = { "rmt__bingzhao_draw", "Cancel" },
            skill_name = skillName,
            prompt = "#rmt__bingzhao-ask:" .. player.id
          }
        ) ~= "Cancel"
      then
        num = 2
      end
    end
    player:drawCards(num, skillName)
    if player.dead then return end
    room:addPlayerMark(player, "@" .. skillName, num)
  end,
})

return guju
